<?php
function addnewLog($str,$type='log')
{
	$file_name=C("excel_file_path")."do_log/".$type."_".DO_GROUP_KEY.".txt";
	//echo $file_name;

	$number=writeFile($file_name,$str."\r\n");
	//$number=file_put_contents($str,$file_name);
	//die();
}

function addUpLog($str)
{
	addnewLog($str,'up');
}

function notfindLog($str)
{
	addnewLog($str,'nf');
}


function writeFile($file_name,$str)
{
	$file = fopen($file_name,"a+");
	$number=fwrite($file,$str);
	//var_dump($number);
	fclose($file);
}


function iconv_gtu($str)
{
	return iconv("GBK","UTF-8",$str);
}

function iconv_utg($str)
{
	return iconv("UTF-8","GBK",$str);
}


function findRowKey($one_row,$nead_row)
{
	$row_key=array();
	foreach($one_row as $key=>$v)
	{
		
		$v=strtolower($v);
		foreach($nead_row as $nead_key=>$nead_v)
		{
			if(in_array($v, $nead_v))
			{
				$row_key[$nead_key]=$key;
				continue;
			}

		}
	}

	if(count($row_key)==count($nead_row))
	{
		return $row_key;
	}
	else
	{
		
		return false;
	}
}